package BinarySearch;

import org.junit.jupiter.api.Test;
import static org.junit.jupiter.api.Assertions.assertEquals;
public class BinarySearchTest {
    @Test
    public void test(){
        int[]a = {1,5,9,13,32,56,77};
        assertEquals(0,BinarySearch.search(a,1));
        assertEquals(1,BinarySearch.search(a,5));
        assertEquals(2,BinarySearch.search(a,9));
        assertEquals(3,BinarySearch.search(a,13));
        assertEquals(4,BinarySearch.search(a,32));
        assertEquals(5,BinarySearch.search(a,56));
        assertEquals(6,BinarySearch.search(a,77));
        System.out.println("------------------------");
        assertEquals(-1,BinarySearch.search(a,2));
        assertEquals(-1,BinarySearch.search(a,15));
        assertEquals(-1,BinarySearch.search(a,39));
    }
}
